/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package onlineslideshow.html;

import javax.swing.ImageIcon;

/**
 *
 * @author alex.nebel
 */
public class ImageElement extends ImageIcon{

    private String title;
    private String description;
    private String htmlImage;
    private String htmlImageGallery;
    private String htmlImageThumb;

    public ImageElement(){
        title = "";
        description = "";
        htmlImage = "";
        htmlImageGallery = "";
        htmlImageThumb = "";
    }

    public String getHtmlImage() {
        return htmlImage;
    }

    public void setHtmlImage(String htmlImage) {
        this.htmlImage = htmlImage;
    }

    public String getHtmlImageGallery() {
        return htmlImageGallery;
    }

    public void setHtmlImageGallery(String htmlImageGallery) {
        this.htmlImageGallery = htmlImageGallery;
    }

    public String getHtmlImageThumb() {
        return htmlImageThumb;
    }

    public void setHtmlImageThumb(String htmlImageThumb) {
        this.htmlImageThumb = htmlImageThumb;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }



    public boolean checkImage(){
        if(title != null && !title.equals("")){
            if(description != null && !description.equals("")){
                if(htmlImage != null && !htmlImage.equals("")){
                    if(htmlImageGallery != null && !htmlImageGallery.equals("")){
                        if(htmlImageThumb != null && !htmlImageThumb.equals("")){
                            return true;
                        }
                    }
                }
            }
        }
        return false;
    }

    @Override
    public String toString(){
        StringBuilder code = new StringBuilder();
        code.append("\t\t<div class=\"imageElement\">\n");
        code.append("\t\t\t<h3>"+title+"</h3>\n");
        code.append("\t\t\t<p>"+description+"</p>\n");
        code.append("\t\t\t<a href=\""+htmlImage+"\" title=\"open image\" class=\"open\"></a>\n");
        code.append("\t\t\t<img src=\""+htmlImageGallery+"\" class=\"full\" />\n");
        code.append("\t\t\t<img src=\""+htmlImageThumb+"\" class=\"thumbnail\" />\n");
        code.append("\t\t</div>\n");
        return code.toString();
    }

    public ImageIcon rescale(int newHeight, int newWidth){
        return this;
    }
}
